FROM ubuntu:latest

MAINTAINER wang_sgang wang_sgang@massclouds.com

RUN sed -i "s/archive.ubuntu/mirrors.aliyun/g" /etc/apt/sources.list && apt-get update

RUN apt-get install -y gcc g++ libpng-dev python3 python3-pip python3-psycopg2 libsasl2-dev 

RUN mkdir ~/.pip && echo "[global]\nindex-url = https://mirrors.aliyun.com/pypi/simple/\n\n[install]\ntrusted-host=mirrors.aliyun.com">~/.pip/pip.conf && pip3 install --upgrade pip && sed -i "s/import main/import __main__/g" /usr/bin/pip3 && sed -i "s/main()/__main__._main()/g" /usr/bin/pip3 && pip3 install kylinpy && pip3 install superset 

ENV LANG C.UTF-8  
ENV LANGUAGE C:en  
ENV LC_ALL C.UTF-8

RUN fabmanager create-admin --app superset --username admin --password admin --firstname admin --lastname admin --email wang_sgang@mail.massclouds.com
RUN superset db upgrade && superset load_examples && superset init

EXPOSE 8088

CMD ["superset", "runserver","-d","-p","8088"]

